<!DOCTYPE html>
<!--
 * Copyright (c) 2010 The Chromium Authors. All rights reserved.  Use of this
 * source code is governed by a BSD-style license that can be found in the
 * LICENSE file.
-->
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF8" /> 
  </head>
  <body>
    <script>
      /**
       * Returns a handler which will open a new window when activated.
       */
      function getClickHandler() {
        return function(info, tab) {

          // The srcUrl property is only available for image elements.
          var url = 'http://www.douban.com/search?search_text=' + info.selectionText;

          // Create a new tab to the info page.
          chrome.tabs.create({ url: url}); 
        };
      };

      /**
       * Create a context menu which will only show up for images.
       */
      chrome.contextMenus.create({
        "title" : "豆瓣抓",
        "contexts":['all'],
        "onclick" : getClickHandler()
      });
    </script>
  </body>
</html>